/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.Q000;
import queenb.net.entitybean.Q100;
import queenb.web.inteface.Q000Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class Q000Store extends Q000 implements Q000Inf {

    @Override
    public List<Q000> getListQ000(int pnFH000, int pnFH200, int pnFN100, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_Q000, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, Q000.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public List<Q000> getListQ000Combo(int pnFH000, int pnFH200, int pnFN100, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.COMBO_Q000, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, Q000.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateQ000(int pnFH000, int pnFH200, int pnFQ000, int pnFN100, String pvQV001, String pvQV002, String pvQV003, int pnQN004, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.UPDATE_Q000, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFQ000),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvQV001),
                        new Param(OracleTypes.CHAR, pvQV002),
                        new Param(OracleTypes.CHAR, pvQV003),
                        new Param(OracleTypes.INTEGER, pnQN004),
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            Param[] p = dataStatement.getMapParam();
            return super.update(dataStatement, Q000.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int deleteQ000(int pnFQ000, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_Q000, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFQ000),
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            Param[] p = dataStatement.getMapParam();
            return super.update(dataStatement, Q000.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q000Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
}
